﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SignalrClientTest
{
    public class SignalrData
    {
        public string content { get; set; }
        public SignalrMessage data { get; set; }
        public int mid { get; set; }
    }

    /// <summary>
    /// 接收到消息json封装
    /// </summary>
    public class SignalrMessage
    {
        public int messageId { get; set; }

        public CategoryType category { get; set; }
        /// <summary>
        /// 不需要设置，自动根据msgType和orderType计算值
        /// </summary>
        public int type { get; set; }
        public string content { get; set; }
        public string newsImage { get; set; }
        public string url { get; set; }
        /// <summary>
        /// 不需要设置，自动为当前时间
        /// </summary>
        public DateTime time { get; set; } = DateTime.Now;
    }

    public enum CategoryType
    {
        msg = 1,
        order = 2,
        /// <summary>
        /// 优惠券
        /// </summary>
        youhuiquan = 3,
    }

    /// <summary>
    /// graph,product
    /// </summary>
    public enum MsgType
    {
        /// <summary>
        /// 图文消息
        /// </summary>
        graph = 1,
        /// <summary>
        /// 商品
        /// </summary>
        product = 2,
    }

    /// <summary>
    /// remindPayment,sendedProduct,timeOut,Error
    /// </summary>
    public enum OrderType
    {
        /// <summary>
        /// 提醒用户付款
        /// </summary>
        remindPayment = 1,
        /// <summary>
        /// 订单已发货
        /// </summary>
        sendedProduct = 2,
        /// <summary>
        /// 交易超时
        /// </summary>
        timeOut = 3,
        /// <summary>
        /// 订单异常
        /// </summary>
        Error = 4,
    }
}
